package com.pagepub.core.tag.validator;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;

public class DisplayRightMessage extends FormValidateBasic {
	/**
	 * 
	 */
	private static final long serialVersionUID = -3719840434758764890L;
	/**
	 * @param args
	 */
	private String rightimage;
	private String rightwordcolor;
	
	public String getRightwordcolor() {
		return rightwordcolor;
	}
	public void setRightwordcolor(String rightwordcolor) {
		this.rightwordcolor = rightwordcolor;
	}
	public String getRightimage() {
		return rightimage;
	}
	public void setRightimage(String rightimage) {
		this.rightimage = rightimage;
	}
	
	public int doStartTag() throws JspException {
		// TODO 自动生成方法存根
		JspWriter out=this.pageContext.getOut();
		
		try{
			out.print(displaymessage());
			
		}
		catch(Exception e){
			e.printStackTrace();
		}			
		
		return 1;
	}
	public StringBuffer  displaymessage(){
		StringBuffer str=new StringBuffer();
		str.append("<script language=\"javascript\">");
		str.append("function displayrightmessage(realvalue,spanname,realname){");
		str.append("if(realvalue!=\"\"){");
		str.append("	message=\"恭喜!该\"+realname+\"可以使用\";");
		str.append("	imgurl=\"<img src=\\\""+this.rightimage+"\\\"/>\";	");
		
		str.append("document.getElementById(spanname).innerHTML=imgurl+\"<font color=\\\"" + this.getRightwordcolor()
				+ "\\\">\"+message+\"</font>\";");
	    str.append("}");
		str.append("}");
		str.append("</script>");
		return str;
	}
}
